<template>
  <div class="index">
    <!-- 视图区 -->
    <router-view class="view"/>

    <!-- 导航区 -->
    <div class="nav">
      <router-link
        v-for="({ to, tag, icon, text }, index) in navList"
        :key="index"
        :to="to"
        :tag="tag">
          <i :class="['iconfont', icon]"></i>
          <div>{{ text }}</div>
      </router-link>
    </div>
  </div>
</template>

<script>

export default {
  data() {
    return {
      navList: [
        {
          to: '/index/home',
          tag: 'div',
          text: '首页',
          icon: 'icon-home'
        },
        {
          to: '/index/find',
          tag: 'div',
          text: '发现',
          icon: 'icon-fenlei'
        },
        {
          to: '/index/order',
          tag: 'div',
          text: '订单',
          icon: 'icon-gouwuche'
        },
        {
          to: '/index/my',
          tag: 'div',
          text: '我的',
          icon: 'icon-wode'
        }
      ]
    }
  },
}
</script>

<style lang="scss">
@import url(../assets/fonts/iconfont.css);

.index {
  width: 100%;
  height: 100%;
  .nav {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 10;
    background: #fff;
    width: 100%;
    height: 55px;
    border-top: solid 1px #ccc;
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    i {
      display: inline-block;
      font-size: 24px;
    }
  }
  .view {
    width: 100%;
    height: calc(100% - 56px);
  }
}
</style>
